package com.ada.iwan.controller.home;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.ada.article.service.ArticleService;
import com.ada.iwan.controller.BaseController;

@Controller
@RequestMapping(value = "article")
public class ArticleController extends BaseController {

	
	@Autowired
	ArticleService articleService;
	
	
	@RequestMapping(value = "/view", method = RequestMethod.GET)
	public String view(Long id,Model model) {
		model.addAttribute("article", articleService.findById(id));
		return getView("article/view");
	}
	
	@RequestMapping(value = "/index", method = RequestMethod.GET)
	public String index(Model model) {
		return getView("article/index");
	}
}
